Array.prototype.contains = function(obj) 
    {
        var i = this.length;
        while (i--)
        {
            if (this[i] === obj)
            {
        	return true;
            }
        }
    return false;
    }

    Array.prototype.add = function(key, value) 
    {
        if(this.contains(key))
            this[key] = value;
        else
        {
            this.push(key);
            this[key] = value;
        }
    }
	Array.prototype.remove = function(key) 
    {
        for(var i = 0; i < this.length; ++i)
        {
            if(this[i] == key)
            {
                this.splice(i, 1);
                return;
            }
        }
    }
